# write by hasaki
# first edit on 2019/01/30
# last change on 2019/01/30
# gateio的单元测试
from hashakisea.api.digital.gateio import GateIO
import unittest as ut

class Gateio_unittest(ut.TestCase):
    def __init__(self,api_key,screte_key):
        self.gate=GateIO()
        self.gate.setKey(api_key,screte_key)
    
    def test_pairs(self):
        print("test all pairs")
        data=self.gate.pairs()

    def test_market_info(self):
        print("test market info")
        data=self.gate.marketinfo()

    def test_market_list(self):
        print("test_market_list")
        data=self.gate.marketlist()
    
    def test_open_order(self):
        print("test open order")
        data=self.gate.openOrders()
    
    def test_24h_trade_history(self):
        print("test 24h trade history")
        data=self.gate.mytradeHistory('btc_usdt','1312312')

    def test_tick(self):
        print("tick test:")
        data=self.gate.ticker('eos_usdt')

    def test_depth(self):
        print("depth test")
        data=self.gate.orderBook('eos_usdt')
    
    def test_account(self):
        print('account test')
        data=self.gate.balances()
    
    def test_buy(self):
        print('buy test')
        data=self.gate.buy('eos_usdt','0.01','30')
    
    def test_sell(self):
        print('sell test')
        data=self.gate.sell('eos_usdt','0.01','30')
    
    def test_cancel(self):
        print('cancel test')
        data=self.gate.cancelOrder('2312312','eos_usdt')
        
ut.main()